import React from 'react'
import CatalogPanel from '@components/business/CatalogPanel'
import type {DataSourceTreeNode} from '@/types/source'

interface Props {
  selectedNode?: DataSourceTreeNode | null
  onUpdated?: () => void
}

// 专用于处理 nodeType 为 CATALOG 的右侧页面视图
export default function CatalogDetailView({ selectedNode, onUpdated }: Props) {
  const tRaw = String(selectedNode?.nodeType ?? (selectedNode as any)?.type ?? '')
  if (tRaw.toUpperCase() !== 'CATALOG' || !selectedNode?.name) return null
  return (
    <CatalogPanel catalogName={selectedNode.name} onUpdated={onUpdated} />
  )
}